import request from '@/utils/request'

// 添加地址
export const addAddress = data => {
  return request({
    url: '/address',
    method: 'post',
    data
  })
}

// 获取地址
export const getAddress = params => {
  return request({
    url: '/address',
    method: 'get',
    params
  })
}

// 修改地址
export const etidAddress = data => {
  console.log(data)
  return request({
    url: '/address/' + data.id,
    method: 'put',
    data
  })
}

// 删除地址
export const deleteAddress = id => {
  return request({
    url: '/address/' + id,
    method: 'delete',
  })
}

// 创建订单
export const creatOrder = data => {
  return request({
    url: '/orders',
    method: 'post',
    data
  })
}

// 修改订单
export const putOrder = (id, data) => {
  return request({
    url: '/orders/' + id,
    method: 'put',
    data
  })
}

// 修改订单
export const getOrder = (params) => {
  return request({
    url: '/orders',
    method: 'get',
    params
  })
}

// 修改订单
export const deleteOrder = (id) => {
  return request({
    url: '/orders/' + id,
    method: 'delete',

  })
}
